package com.customer.example;

import com.customer.config.RibbonRoleConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableEurekaClient
@RibbonClient(name = "study-provider", configuration = RibbonRoleConfig.class)
public class StudyCustomerApplication {

    public static void main(String[] args) {
        SpringApplication.run(StudyCustomerApplication.class, args);
    }

    @Bean
    @LoadBalanced // 开启rebbon的负载均衡（客户端的软负载均衡）
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

}
